#include "commands.h"
#include "document.h"

RemovePageCommand::RemovePageCommand(Page *page, Document *document): QUndoCommand(0)
{
    m_page = page;
    m_document = document;
    m_pageNumber = document->pageList()->indexOf(page);
}

void RemovePageCommand::undo()
{
    m_document->insertPage(m_pageNumber, m_page);
}

void RemovePageCommand::redo()
{
    m_document->pageList()->removeOne(m_page);
    m_page->scene()->removeItem(m_page);
    m_document->rePositionPages();
}



